<!DOCTYPE html>
<html >
<head>
    <meta charset="UTF-8">
    <title>主生产计划</title>
    <script type="text/javascript">
        $(function () {
            $.post("scgl_scjhmxselect", null,
                function (data) {
                    for(var i=0;i<data.length;i++){
                        var html="<tr>\n" +
                            "                     <td class=\"scgl_scgl_thirdtable_tr_td\">"+(i+1)+"</td>\n" +
                            "                     <td class=\"scgl_scgl_thirdtable_tr_td\">"+data[i].scglScjhmxItemnum+"</td>\n" +
                            "                     <td class=\"scgl_scgl_thirdtable_tr_td\">"+data[i].scglScjhmxItemname+"</td>\n" +
                            "                     <td class=\"scgl_scgl_thirdtable_tr_td\">"+data[i].scglScjhmxSpecifications+"</td>\n" +
                            "                     <td class=\"scgl_scgl_thirdtable_tr_td\">"+data[i].scglScjhmxUnit+"</td>\n" +
                            "                     <td class=\"scgl_scgl_thirdtable_tr_td\">"+data[i].scglScjhmxDemandnum+"</td>\n" +
                            "                     <td class=\"scgl_scgl_thirdtable_tr_td\">"+data[i].scglScjhmxStartdate+"</td>\n" +
                            "                     <td class=\"scgl_scgl_thirdtable_tr_td\">"+data[i].scglScjhmxOverdate+"</td>\n" +
                            "                 </tr>"
                        $("#scgl_scgl_thirdtable").append(html);
                    }
                }, "json");
        });
       //非空验证
        function verify() {
            var scgl_scjhmx_itemNum = $("#scgl_scjhmx_itemNum").val();
            var scgl_scjhmx_itemName = $("#scgl_scjhmx_itemName").val();
            var scgl_scjhmx_specifications = $("#scgl_scjhmx_specifications").val();
            var scgl_scjhmx_unit = $("#scgl_scjhmx_unit").val();
            var scgl_scjhmx_demandNum = $("#scgl_scjhmx_demandNum").val();
            var scgl_scjhmx_startDate = $("#scgl_scjhmx_startDate").val();
            var scgl_scjhmx_overDate = $("#scgl_scjhmx_overDate").val();


            if(!scgl_scjhmx_startDate==""&&!scgl_scjhmx_overDate==""){
                alert(scgl_scjhmx_startDate>=scgl_scjhmx_overDate);
                if(scgl_scjhmx_startDate>=scgl_scjhmx_overDate){
                    alert("完工时间必须大于开工时间");
                        return false;
                }
            }

            if (scgl_scjhmx_itemNum ==null||scgl_scjhmx_itemNum=="") {
                alert('物品编号不能为空');
                return false;
            }
            if (scgl_scjhmx_itemName == null||scgl_scjhmx_itemName=="") {
                alert('物品名字不能为空');
                return false;
            }
            if (scgl_scjhmx_specifications == null ||scgl_scjhmx_specifications=="") {
                alert('规格不能为空');
                return false;
            }
            if (scgl_scjhmx_unit ==null ||scgl_scjhmx_unit=="") {
                alert('单位不能为空');
                return false;
            }
            if (scgl_scjhmx_demandNum == null||scgl_scjhmx_demandNum=="" ) {
                alert('数量不能为空');
                return false;
            }
            if (scgl_scjhmx_startDate ==null||scgl_scjhmx_startDate=="") {
                alert('计划开始时间不能为空');
                return false;
            }
            if (scgl_scjhmx_overDate == null ||scgl_scjhmx_overDate=="") {
                alert('计划结束时间不能为空');
                return false;
            }
        }
        //时间模板
        layui.use('laydate', function() {
            var laydate = layui.laydate;

            //日期时间选择器
            laydate.render({
                elem: "#scgl_scjhmx_startDate"

            });
            laydate.render({
                elem: "#scgl_scjhmx_overDate"

            });

        });

    </script>

<style>
    .scgl_scgl_firstul {
        margin-top: 10px;
    }

    .scgl_scgl_firstul li {
        list-style: none;
        float: left;
        margin-left: 10px;
    }
    .scgl_scgl_firstdiv {

        height: 55px;
        width: 100%;
        border: 2px solid slategray;
    }


    .scgl_scgl_firsttable tr {
        border-bottom: 2px solid slategray;

    }


    .scgl_scgl_firsttable_tr_td01 input{
        border: none;
        width: 100%;
        height: 100%;
    }
    .scgl_scgl_thirdiv {
        margin-top: 10px;
        width: 100%;
        height: 200px;
    }
    .scgl_scgl_secondtable {

        width: 100%;
        height: 100%;
        border:slategray 2px solid ;
    }

    .scgl_scgl_secondtable tr{
        border-bottom: 2px solid slategray;
    }

    .scgl_scgl_secondtable_tr_td {
        background-color: #FFFFF0;
        border-right: 2px solid slategray;
        width: 14%;
        height: 25%;
    }
    .scgl_scgl_secondtable_tr_td01 input {
        border: none;
        width: 100%;
        height: 100%;
    }
    .scgl_scgl_secondtable_tr_td01 {
        border-right: 2px solid slategray;
        width: 14%;
        height: 14%;
    }

    .scgl_scgl_thirdtable tr{
        border-bottom: 2px solid slategray;
    }
    .scgl_scgl_thirdtable_tr_td {

        border-right: 2px solid slategray;
        width: 12.5%;
        height: 50%;
    }
</style>
</head>
<body>

<div style="background-color: white">
    <!--页面主题-->
    <div style="height: 50px;width: 100%; font-weight: bold;text-align: center;font-size: 30px">新建计划订单</div>
    <!--form表单-->
    <form action="/scgl_scjhmxInsert" onsubmit="return verify()">
        <!--操作按钮-->
        <div class="scgl_scgl_firstdiv">
            <ul class="scgl_scgl_firstul">
                <li><input class="layui-btn layui-btn-radius" type="submit" value="保存"></li>
            </ul>
        </div>
        <!-- /基本信息下需要填写的信息-->
        <!--     合计信息   -->
        <div class="scgl_scgl_thirdiv">
            <table class="scgl_scgl_secondtable" cellpadding="0px" cellspacing="0px" border="2px" >
                <!--     第1行-->
                <tr>
                    <td colspan="6">详细信息</td>
                </tr>
                <!--               第2行-->
                <tr>
                    <td class="scgl_scgl_secondtable_tr_td">物品编号</td>
                    <td class="scgl_scgl_secondtable_tr_td01">
                        <input  type="text" id="scgl_scjhmx_itemNum"  name="scgl_scjhmx_itemNum"/>
                    </td>
                    <td class="scgl_scgl_secondtable_tr_td">物品名字</td>
                    <td class="scgl_scgl_secondtable_tr_td01">
                        <input  type="text" id="scgl_scjhmx_itemName" name="scgl_scjhmx_itemName"/>
                    </td>
                    <td class="scgl_scgl_secondtable_tr_td">规格</td>
                    <td class="scgl_scgl_secondtable_tr_td01">
                        <input type="text" name="scgl_scjhmx_specifications"  id="scgl_scjhmx_specifications"/>
                    </td>
                </tr>
                <!--              第五行-->
                <tr>
                    <td class="scgl_scgl_secondtable_tr_td">基本单位</td>
                    <td class="scgl_scgl_secondtable_tr_td01">
                        <input  type="text" id="scgl_scjhmx_unit"  name="scgl_scjhmx_unit"/>
                    </td>
                    <td class="scgl_scgl_secondtable_tr_td">需求数量</td>
                    <td class="scgl_scgl_secondtable_tr_td01">
                        <input type="text" name="scgl_scjhmx_demandNum"  id="scgl_scjhmx_demandNum">
                    </td>
                    <td class="scgl_scgl_secondtable_tr_td"></td>
                    <td class="scgl_scgl_secondtable_tr_td01">
                        <input  type="text"/>
                    </td>
                </tr>
                <!--              第六行-->
                <tr>
                    <td class="scgl_scgl_secondtable_tr_td">计划生产时间</td>
                    <td class="scgl_scgl_secondtable_tr_td01">
                        <input  type="text" id="scgl_scjhmx_startDate" name="scgl_scjhmx_startDate"/>
                    </td>
                    <td class="scgl_scgl_secondtable_tr_td">计划完成时间</td>
                    <td class="scgl_scgl_secondtable_tr_td01">
                        <input  type="text" id="scgl_scjhmx_overDate" name="scgl_scjhmx_overDate"/>
                    </td>
                    <td class="scgl_scgl_secondtable_tr_td"></td>
                    <td class="scgl_scgl_secondtable_tr_td01">
                        <input  type="text" />
                    </td>
                </tr>
            </table>
        </div>
    </form>
    <!--/form表单-->
</div>

</body>
</html>